package org.windblog.core.servlet.post;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.windblog.core.PostService;
import org.windblog.core.entity.Post;

@SuppressWarnings("serial")
public class DeletePostServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		
		Post post = null;
		String postkey = request.getParameter("post");
		post = PostService.getPost(postkey);
		PostService.deletePost(post);
		
		response.sendRedirect("/admin/editPost.jsp?deleted=1");
		
	}
}
